package com.itheima.springbootenable;


import com.itheima.config.EnableUser;
import com.itheima.config.MyImportBeanDefinitionRegistrar;
import com.itheima.config.MyImportSelector;
import com.itheima.config.UserConfig;
import com.itheima.domain.Role;
import com.itheima.domain.User;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Import;
import redis.clients.jedis.Jedis;

import java.util.Map;


@SpringBootApplication
//@ComponentScan("com.itheima.config")
//@Import(UserConfig.class)
//@EnableUser
//@Import(User.class)
//@Import(UserConfig.class)
//@Import(MyImportSelector.class)
@Import(MyImportBeanDefinitionRegistrar.class)
public class SpringbootEnableApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(SpringbootEnableApplication.class, args);

        /*//获取bean
        Object user = context.getBean("user");
        System.out.println(user);*/
        /*User user = context.getBean(User.class);
        System.out.println(user);

        Role role = context.getBean(Role.class);
        System.out.println(role);*/

        /*Object user = context.getBean("user");
        System.out.println(user);*/
        /*Map<String, User> map = context.getBeansOfType(User.class);
        System.out.println(map);*/
        Jedis jedis=context.getBean(Jedis.class);
        System.out.println(jedis);

        jedis.set("name","tom");
        String name = jedis.get("name");
        System.out.println(name);
    }

}
